/*
 * Copyright 2009, Qys Creations 
 * 
 *  This file is part of Chameleon DB.
 *
 *  Chameleon DB is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Chameleon DB is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Chameleon DB.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * */



public class db_where_condition {
	public db_column oColumn1 = null;
	public db_column oColumn2 = null;

	public int iCompareOperator = 0;
	public String sValue1 = "";
	public String sValue2 = "";
	public int iType1 = 0;
	public int iType2 = 0;
	
	db_where_condition (String sValueStr1, String sValueStr2, int iDataType1, int iDataType2, int iCompOp){
		sValue1 = sValueStr1;
		sValue2 = sValueStr2;
		iType1 = iDataType1;
		iType2 = iDataType2;
		iCompareOperator = iCompOp;
	}
		
	public boolean eval(int iVal1, int iVal2) {
		switch (iCompareOperator) {
			case 1: return (iVal1 == iVal2); 
			case 2: return (iVal1 <= iVal2); 
			case 3: return (iVal1 >= iVal2); 
			case 4: return (iVal1 < iVal2); 
			case 5: return (iVal1 > iVal2); 
		}
		return false;
	}
}
